<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>确认订单</title>
    <link rel="stylesheet" href="/layui/css/layui.css">
    <script src="/layui/layui.js"></script>
    <script type="text/javascript" src="/jquery.min.js"></script>
    <script type="text/javascript" src="/sb/Tips.min.js"></script>
</head>
<body>

<div class="" style="padding:15px;">

    <link rel="stylesheet" href="/goods/order.css"/>
    <div class="dd-wrapper" id="myElementId">
        <div class="dd-info">
            <p class="mb"><strong th:text="${'订单编号：'+orderVo.getOrderId()}"></strong></p>
        </div>
        <div class="dd-info">
            <p class="mb"><strong th:text="${T(com.b2c.entity.enums.third.EnumDouYinOrderStatus).getThirdStatusName(orderVo.getOrderStatus())}">订单状态：</strong>
            </p>
        </div>
    </div>
    <form class="layui-form layui-form-pane1">
        <input type="hidden" name="orderId" th:value="${orderVo.getOrderId()}" />
        <div class="layui-form-item">
            <label class="layui-form-label">收货人</label>
            <div class="layui-input-block">
                <input type="text" name="receiver" autocomplete="off" lay-verify="required" lay-reqtext="收货人必填"
                       th:value="${orderVo.getPostReceiver()}" placeholder="收货人" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">手机号</label>
            <div class="layui-input-block">
                <input type="text" name="mobile" lay-verify="required" autocomplete="off"
                       th:value="${orderVo.getPostTel()}" placeholder="收货人手机号" maxlength="11" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">收货地址</label>
            <div class="layui-input-block">
                <input type="text" name="address" lay-verify="required" autocomplete="off" th:value="${orderVo.getPostAddr()}"
                       placeholder="收货地址" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">卖家备注</label>
            <div class="layui-input-block">
                <textarea placeholder="卖家备注" name="sellerMemo" th:text="${orderVo.getSellerWords()}" class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button type="submit" lay-filter="orderConfirm" class="layui-btn" lay-submit="" >订单确认</button>
            </div>
        </div>
    </form>


    <!-- end dd-wrapper -->
    <script>
        //JavaScript代码区域
        var index = 0;
        try {
            index = parent.layer.getFrameIndex(window.name); //获取窗口索引
        }catch (e) {
        }
        var layer;
        var $;
        var form;
        layui.use(['laydate', 'jquery', 'form', 'layer'], function () {
            var laydate = layui.laydate;
            form = layui.form;
            layer = layui.layer;
            $ = layui.jquery;

            //监听提交
            form.on('submit(orderConfirm)', function(data){
                if(confirm("确定订单操作将会把该订单推送到仓库，是否要确认订单？")) {
                    $.ajax({
                        url: "/ajax_douyin/affirm_order",
                        type: "POST",
                        dataType: "JSON",
                        contentType: 'application/json',
                        data: JSON.stringify(data.field),
                        success: function (res) {
                            if (res.code == 0) {
                                alert("确认成功！");
                                parent.layer.close(index);
                                parent.location.reload();
                            } else {
                                alert(res.msg);
                            }
                        }
                    })
                }
                return false;
            });



        });
    </script>
</div>
</body>
<html>
